package com.chenjiagou.feign;

import com.chenjiagou.pojo.Notification;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collections;
import java.util.List;

@FeignClient(name = "notification-service")
public interface NotificationFeignClient {
    @GetMapping("/notification/findByUserId/{userId}")
    List<Notification> findNotificationByUserId(@PathVariable("userId") int userId);

    @PostMapping("/notification/markAsRead/{userId}/{notificationId}")
    void markAsRead(@PathVariable("userId") int userId,
                    @PathVariable("notificationId") int notificationId);


    @GetMapping("/notification/findUnreadByUserId/{userId}")
    List<Notification> findUnreadByUserId(@PathVariable("userId") int userId);

    @DeleteMapping("/notification/delete/{id}")
    void deleteNotification(@PathVariable("id") int id);



    @PostMapping("/admin/notification/publish")
    void publishNotification(@RequestParam("flightId") int flightId,
                             @RequestParam("title") String title,
                             @RequestParam("content") String content);

}
